<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>

<body>
  <div id="vm">
    <cpn1></cpn1>
    <cpn2></cpn2>
  </div>
  <script>
    // const cpnC1 = Vue.extend({ //传入对象
    //   template: `<div>
    //               <h1>我是标题1</h1>
    //               <p>123123</p>
    //             </div>`      //``定义模板字符串
    // })  //普通注册
    Vue.component('cpn1', { //传入对象
      template: `<div>
                  <h1>我是标题1</h1>
                  <p>123123</p>
                </div>`      //``定义模板字符串
    }) //全局组件注册
    var vm = new Vue({
      el: '#vm',
      data: {
        name: 'Taec'
      },
      components: {
        'cpn2': { //传入对象
          template: `<div>
                  <h1>我是标题2</h1>
                  <p>1231232323</p>
                </div>`      //``定义模板字符串
        } //局部组件注册
      }
    })
  </script>
</body>

</html>